package com.pi.cs.facade;

import java.util.ArrayList;
import java.util.List;

import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;

import com.pi.cs.dao.entity.CsUserFeedbackEntity;
import com.pi.cs.enumerate.FeedStatus;
import com.pi.cs.model.vo.SmartBedFeedBackVo;

@Service
public class FeedBackFacade {

  public List<SmartBedFeedBackVo> transFeedBackIntoSmartBedFormat(
      List<CsUserFeedbackEntity> list){
    List<SmartBedFeedBackVo> voList = new ArrayList<>();
    if(CollectionUtils.isEmpty(list)){
      return voList;
    }
    for(CsUserFeedbackEntity entity:list){
      SmartBedFeedBackVo vo = new SmartBedFeedBackVo();
      vo.setFeedContent(entity.getUserAdvice());
      vo.setFeedId(entity.getId().toString());
      vo.setFeedStatus(FeedStatus.getFeedStatus(entity.getStatus()));
      voList.add(vo);
    }
    return voList;
  }
}
